window: Stop juggling cursors
authorMatthias Clasen <mclasen@redhat.com>
Thu, 18 Apr 2019 19:07:01 +0000 (15:07 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 18 Apr 2019 19:07:01 +0000 (15:07 -0400)
We have convenience api for this.

gtk/gtkwindow.c

index 936457692ce62fbb6c098ebf0e09860aa4bbbf5a..57ea9b14ce8677ba522d454715d9b0f146345635 100644 (file)
@@ -1774,7 +1774,6 @@ gtk_window_capture_motion (GtkWidget *widget,
                            gdouble    x,
                            gdouble    y)
 {
-  GdkCursor *cursor = NULL;
   gint i;
   const gchar *cursor_names[8] = {
     "nw-resize", "n-resize", "ne-resize",
@@ -1786,15 +1785,10 @@ gtk_window_capture_motion (GtkWidget *widget,
     {
       if (edge_under_coordinates (GTK_WINDOW (widget), x, y, i))
         {
-          cursor = gdk_cursor_new_from_name (cursor_names[i], NULL);
+          gtk_widget_set_cursor_from_name (widget, cursor_names[i]);
           break;
         }
     }
-
-  gtk_widget_set_cursor (widget, cursor);
-
-  if (cursor)
-    g_object_unref (cursor);
 }
 
 static void